import Vue from 'vue'
import MuseUI from 'muse-ui'
import App from './App.vue'
import 'muse-ui/dist/muse-ui.css'
import axios from 'axios'
import 'typeface-roboto'
import './assets/font-icons/material/material-icons.css';
import './assets/font-icons/style.css';
import './assets/github-markdown.css';
import './assets/atom-one-light.css';
import 'muse-ui-progress/dist/muse-ui-progress.css'
import Progress from 'muse-ui-progress'
import router from './router';
import './registerServiceWorker';
import store from './store'
import { changeLocale } from './locale';
import './theme.js';
import ColorPalette from './components/color-palette';
import DemoBlock from './components/demo-block';

Vue.component(ColorPalette.name, ColorPalette);
Vue.component(DemoBlock.name, DemoBlock);

Vue.use(MuseUI);
Vue.use(Progress, {
  color: 'secondary'
});
Vue.config.productionTip = false
Vue.prototype.axios = axios;
Vue.prototype.apiurl = "http://cj.hnlllq.com/app/index.php?i=2&c=entry&eid=49";
router.beforeEach((to, from, next) => {
  if (to.meta && to.meta.lang) {
    changeLocale(to.meta.lang);
  }
  window.scrollTo(0, 0);
  Progress.start();
  next();
});

router.afterEach(() => {
  Progress.done();
});


const app = new Vue({
  ...App,
  store,
  router
});

app.$mount('#app');
